package cn.cit.training.feignclient.feign;

import cn.cit.training.feignclient.vo.CommonResult;
import cn.cit.training.feignclient.entity.CitData;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * feign client
 * </p>
 *
 * @author
 * @since 2020-09-01
 */
@FeignClient(value = "cit-server")
public interface CitDataFeign {

    /**
     * status
     *
     * @return
     */
    @PutMapping("/")
    CommonResult status() ;

    /**
     * 查询CitData列表
     *
     * @param pageSize 每页记录数
     * @param currentPage 当前页码
     * @return
     */
    @GetMapping("/citDatas")
    CommonResult getCitDataPage(
            @RequestParam(value = "pageSize", required = false, defaultValue = "10")
            @ApiParam(value = "每页记录数", required = false, defaultValue = "10") Integer pageSize,
            @RequestParam(value = "currentPage", required = false, defaultValue = "1")
            @ApiParam(value = "当前页码", required = false, defaultValue = "1") Integer currentPage,
            @RequestParam(value = "field", required = false, defaultValue = "")
            @ApiParam(value = "查询字段：year, t_travel, t_duration", required = false ,example = "t_duration") String field,
            @RequestParam(value = "min", required = false, defaultValue = "0")
            @ApiParam(value = "区间最小", required = false, defaultValue = "0" ,example = "1971") Integer min,
            @RequestParam(value = "max", required = false, defaultValue = "0")
            @ApiParam(value = "区间最大", required = false, defaultValue = "0" ,example = "1980") Integer max);

    /**
     * 查询CitData
     *
     * @param id 唯一主键 _id
     * @return
     */
    @GetMapping("/citDatas/{id}")
    CommonResult getCitDataById(@PathVariable("id") Integer id) ;

    /**
     * 添加CitData
     *
     * @param CitData
     * @return
     */
    @PostMapping("/citDatas")
    CommonResult createCitData(@RequestBody CitData CitData) ;

    /**
     * 删除CitData
     *
     * @param id
     * @return
     */
    @DeleteMapping("/citDatas/{id}")
    CommonResult deleteCitData(@PathVariable("id") Integer id) ;

    /**
     * 更新CitData
     *
     * @param id
     * @param CitData
     * @return
     */
    @PutMapping("/citDatas/{id}")
    CommonResult  updateCitData(@PathVariable("id") Integer id, @RequestBody CitData CitData) ;

}

